import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EmgStructureVO, EmgStructureForm, EmgStructureQuery } from '@/api/biz/emgStructure/types';

/**
 * 查询组织架构列表
 * @param query
 * @returns {*}
 */

export const listEmgStructure = (query?: EmgStructureQuery): AxiosPromise<EmgStructureVO[]> => {
  return request({
    url: '/biz/emgStructure/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询组织架构详细
 * @param id
 */
export const getEmgStructure = (id: string | number): AxiosPromise<EmgStructureVO> => {
  return request({
    url: '/biz/emgStructure/' + id,
    method: 'get'
  });
};

/**
 * 新增组织架构
 * @param data
 */
export const addEmgStructure = (data: EmgStructureForm) => {
  return request({
    url: '/biz/emgStructure',
    method: 'post',
    data: data
  });
};

/**
 * 修改组织架构
 * @param data
 */
export const updateEmgStructure = (data: EmgStructureForm) => {
  return request({
    url: '/biz/emgStructure',
    method: 'put',
    data: data
  });
};

/**
 * 删除组织架构
 * @param id
 */
export const delEmgStructure = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz/emgStructure/' + id,
    method: 'delete'
  });
};
